package com.qzimp.fujiancuo.exceptions;


import com.qzimp.fujiancuo.entity.vo.StatusCode;
import lombok.Data;

@Data
public class ApiException extends  RuntimeException{
    private int code;
    private String msg;
    private  boolean success;

    // 手动设置异常
    public ApiException(StatusCode statusCode) {
        // message用于用户设置抛出错误详情，例如：当前价格-5，小于0
        // 状态码
        this.code = statusCode.getCode();
        // 状态码配套的msg
        this.msg = statusCode.getMsg();
        this.success=false;
    }

    public ApiException(StatusCode statusCode,String error){

        this.code=statusCode.getCode();
        this.msg=error;
        this.success=false;
    }

}
